<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Content extends CI_Controller {

	function __construct()
    {
        // Call the Model constructor
        parent::__construct();

        $this->load->model('content_model');
    } 
    
    public function index(){
        
        $layout = array();
        $this->load->library('Rss');
        //$this->rss->set_debug();
        $this->rss->set_items_limit(10); // how many items to retreive from each feed
        $this->rss->set_cache_life(10); // cache life in minutes
        $this->rss->set_cache_path('./cache/'); // by default library used CI default cache path, or path that you set in config.php
         // in debug mode library will output on screen useful data
        
        // parameter can be array or string
        $this->rss->set_url(array('http://rssfeeds.sanook.com/rss/feeds/sanook/movie.now.xml'));
        // return array of objects containing rss data from all feeds
        $news = $this->rss->parse();  
        $layout['new_movie'] = $this->rss->parse(); 
        $layout['contents'] = $this->content_model->get_all();
        $layout = $this->load->view('content/index',$layout,TRUE);
		$this->load->view('layout/template' , array("content" => $layout) );
    }
    
	public function view($id)
	{
	    $layout = array();
	    $layout['content']= $this->content_model->get_by_id($id);
	    $layout = $this->load->view('content/view',$layout,TRUE);
		$this->load->view('layout/template' , array("content" => $layout) );
	}
	
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */